﻿using UnityEngine;

namespace Assets.AnimationPlayer.Scripts.UI
{
    public class AnimationPlayEvents : MonoBehaviour
    {

        public delegate void PlayEndDelegate();
        private int _playTimes;
        public PlayEndDelegate PlayEnd;
        public void ResetTimeCount()
        {
            _playTimes = 0;
        }
        public void AnimationPlayEnd()
        {
            _playTimes++;
            if (_playTimes >=AnimationVar.PlayeTimes)
            {
                _playTimes = 0;
                if (PlayEnd != null)
                {
                    PlayEnd.Invoke();
                }
            }
        }
    }
}

